package com.xbongbong.pro.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * @Author shian
 * @create 2019-12-26 9:26
 * @Description
 */
@Getter
public enum ModuleCenterTabEnum {
    /**
     * 模板中心tab分类
     */
    SELECTED_RECOMMEND("enum.moduleCenterTab.name.selected_recommend", "selectedRecommend", 101, 0),

    INDUSTRY("enum.moduleCenterTab.name.industry", "industry", 201, 0),

    PURPOSE("enum.moduleCenterTab.name.purpose", "purpose", 301, 0),

    UNKONW("unknow", "unknow", 10000, 0),

    ;

    private String name;

    private String alias;

    private int type;

    /**
     * 父节点，如果没有父节点，则此值为空字符串
     */
    private int parent;

    ModuleCenterTabEnum(String name, String alias, int type, int parent) {
        this.name = name;
        this.alias = alias;
        this.type = type;
        this.parent = parent;
    }

    public static ModuleCenterTabEnum getByType(int type) {
        for (ModuleCenterTabEnum tabEnum : values()) {
            if (type == tabEnum.getType()) {
                return tabEnum;
            }
        }
        return UNKONW;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }
}
